import {applyMiddleware, combineReducers, createStore} from "redux";
import thunk from "redux-thunk";
import {connectRouter, routerMiddleware} from "connected-react-router";
import deptManage from "../containers/DepartmentManage/deptReducers";
import entranceManage from "../containers/EntranceManage/entranceReducers";
import devManage from "../containers/EquipmentManage/devReducer";
import staffManage from "../containers/StaffManage/staffReducers";
import {createHashHistory} from "history";
import homeManage from "../containers/Homepage/homepageReducers";
import equipment from "../containers/Equipment/equipmentReducer";
import schoolManage from "../containers/SchoolManage/schoolReducers";
import addressManage from "../containers/EntranceManage/views/AddressManage/addressReducers";

// 安装redux-devtools-extension的可视化工具。
import {composeWithDevTools} from 'redux-devtools-extension'


export const history = createHashHistory({basename: "wisdomCollegeView"})

const rootReducers = combineReducers(
    {
        router: connectRouter(history),
        deptManage, //部门管理的reducers
        entranceManage, //门禁管理的reducers
        devManage, //设备管理的reducers
        staffManage, //人员管理的reducers
        homeManage, //主页的reducers
        equipment,
        schoolManage, //学校管理的reducers
        addressManage,//地址管理的reducers
    })

let store = createStore(
    rootReducers,
    composeWithDevTools(applyMiddleware(thunk, routerMiddleware(history)))
)

export default store;